<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app">
        <input type="text" v-model="val"><button @click="add">确定</button>
        
        <div>
            <h2>正在进行 --- {{len}}</h2>
            <ul>
                <li v-for="(item , key) in arr" v-show="!item.checked">
                    <input v-model="item.checked" type="checkbox">
                    {{item.val}}
                    <button @click="del(key)">删除</button>
                </li>
            </ul>
            <h2>已完成 --- {{arr.length - len}}</h2>
            <ul>
                <li v-for="(item , key) in arr" v-show="item.checked">
                    <input v-model="item.checked" type="checkbox">
                    {{item.val}}
                    <button @click="del(key)">删除</button>
                </li>
            </ul>
        </div>
    </div>
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
    <script>
        new Vue({
            el:'#app',
            data:{
                val:'',
                arr:[]
            },
            methods:{
                add(){
                    this.arr.push({
                        val:this.val,
                        checked:false
                    })
                    this.val = ''
                },
                del(num){
                    this.arr.splice(num , 1)
                }
            },
            computed:{
                len(){
                    return this.arr.filter(res=>{
                        return res.checked === false
                    }).length
                }
            }

        })
    </script>
    
</body>
</html>